package controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import pojo.Food;
import pojo.Merchant;
import service.FoodManager;
import service.MerchantManager;

@Controller
public class MerchantDetailController {
	@Resource(name="merchantManager")
	private MerchantManager merchantManager;
	
	@Resource(name="foodManager")
	private FoodManager foodManager;
	
	@RequestMapping(value = "/merchant", method = RequestMethod.GET)
	public String getMerchantDetail(String id, Model model){
		List<Food> foodList = foodManager.findByType("all", id);
		Merchant merchant = merchantManager.findById(id);
		model.addAttribute("merchant", merchant);
		model.addAttribute("foodList", foodList);
		
		return "foodList";
	}
}
